#include <iostream>
#include "Nod.cpp"
#include "Frunza.cpp"
#include "Operator.h"
#include "Constanta.cpp"
#include "Necunoscuta.cpp"
#include "Plus.cpp"
#include "Minus.cpp"
#include "Inmultit.cpp"
#include "Impartit.cpp"
#include "Exp.cpp"
#include "Logaritm.cpp"
#include "Sin.cpp"
#include "Tangenta.cpp"
#include "Cotan.cpp"
#include "ASin.cpp"
#include "ACos.cpp"
#include "ATan.cpp"
#include "ACtg.cpp"
#include "Functie.cpp"
#include <QtGui> 
#include "myqtapp.h"
#include "lines.h"
#include <fstream>
using namespace std;
// including <QtGui> saves us to include every class user, <QString>, <QFileDialog>,...



myQtApp::myQtApp(QWidget *parent)
{
	setupUi(this); // this sets up GUI

	// signals/slots mechanism in action
	connect( pushButton_do, SIGNAL( clicked() ), this, SLOT( doSomething() ) ); 
	connect( pushButton_clear, SIGNAL( clicked() ), this, SLOT( clear() ) ); 
	
}



void myQtApp::doSomething()
{


	Functie *f;
	double value1,rezultat,rezderivata;
	QByteArray ba=lineEdit->text().toLatin1();	
	char *sir=ba.data();
	char *derivata;
	f = new Functie(sir);
	value1 = lineValx->text().toDouble();
	rezultat=f->calculezValoare(value1);	
	derivata= f->derivata();
	QString d(derivata);
	Qt::CheckState state;
	rezderivata=f->calculezDerivata(value1);	
	textEdit->append( "f(" + QString::number(value1)+")= " + QString::number(rezultat));
	textEdit->append( "Derivata este: " + d);
	textEdit->append( "Valoarea derivatei este " + QString::number(rezderivata));

	
}


void myQtApp::clear()
{
	textEdit->clear();
}

void myQtApp::about()
{


}


